package com.aggeek.springbootlearning.conf;

import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import sun.util.resources.cldr.lag.LocaleNames_lag;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * @author:liuao
 * description:
 * Date: create on 21:06 2018/1/19
 * modify by:
 */
@SuppressWarnings("ALL")
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConf extends AbstractWebSocketMessageBrokerConfigurer {
    ReentrantLock lock = new ReentrantLock();
    ReentrantReadWriteLock lock2 = new ReentrantReadWriteLock();
    @Override
    public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {
        stompEndpointRegistry.addEndpoint("/endpointWisely").withSockJS();
    }

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
       registry.enableSimpleBroker("/topic");



    }
}
